/*
 * @Author: 我想吃余 483766615@qq.com
 * @Date: 2025-10-19 16:54:16
 * @LastEditors: 我想吃余 483766615@qq.com
 * @LastEditTime: 2025-10-20 22:58:39
 * @FilePath: /code/oscode/fifo/client.cc
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
#include "comm.hpp"

int main()
{
    //打开管道
    pid_t fd = open(FIFO_FILE, O_WRONLY, MODE);
    if(fd < 0) 
    {
        perror("open");
        exit(FIFO_OPEN_ERR);
    }

    std::cout<< "client open file done" <<std::endl;

    //开始通信
    string line;
    while (true)
    {
        cout << "Please Entry#";
        getline(cin, line);
        write(fd, line.c_str(), line.size());
    }
    
    close(fd);
    return 0;
}